package interfaces2;

import java.io.File;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.ObjectOutputStream;

public class PointsMain1 {
	private static final String filename = "point1.data";
	/**
	 * main method for Point2D example - using generics
	 * 
	 * @param args
	 * @throws IOException 
	 * @throws FileNotFoundException 
	 */
	public static void main(String[] args) throws FileNotFoundException, IOException {
		Point2D<Integer> p1 = new Point2D<Integer>( 21, -43 );
		Point2D<Double>  p2 = new Point2D<Double>( 2.54, 12.8 );
		Point2D<Float>   p3 = new Point2D<Float>( -0.23f, 34.7f );
		Point2D<String>  p4 = new Point2D<String>( "-0.23", "34.7" );
		
		
		System.out.println(" p1 is " + p1);
		System.out.println(" p2 is " + p2);
		System.out.println(" p3 is " + p3);
		System.out.println(" p4 is " + p4);
		
		ObjectOutputStream os = new ObjectOutputStream( new FileOutputStream( new File( filename ) ) );
		os.writeObject( p1 );
		os.writeObject( p2 );
		os.writeObject( p3 );
		os.writeObject( p4 );
		os.close();
	}
}
